﻿using Company.Core.Config;
using Company.Hardware.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 无人值守地磅称重系统.Interfaces;
using 无人值守地磅称重系统.Models.Config;

namespace 无人值守地磅称重系统.Services
{
    /// <summary>
    /// 程序运行期间参数配置服务类
    /// </summary>
    public class ConfigService : IConfigService
    {
        public HardwareConfig HardwareConfig { get ; set; }

        public SystemConfig SystemConfig{ get; set; }

        public IConfigManager ConfigManager { get; }

        public ConfigService( IConfigManager configManager)
        {
            ConfigManager = configManager;
            HardwareConfig =  ConfigManager.Read<HardwareConfig>(ConfigKey.HardwareConfig) ?? new HardwareConfig();
            SystemConfig = ConfigManager.Read<SystemConfig>(ConfigKey.SystemConfig) ?? new SystemConfig();
        }
    }
}
